<template>
  <div>
    <van-nav-bar
      title="企业介绍"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    />
    <van-cell-group>
      <div class="enterprise-introduction">
      <p>{{enterpriseIntroduction.introductionContent}}</p>
      </div>
      <van-cell class="vancell" title="联系人" value="张三" />
      <van-cell class="vancell" title="联系方式" value="18181818181" />
      <van-cell class="vancell" title="联系地址" value="四川省成都市高新区高新南路1243号" />
      <hr>
    </van-cell-group>
    <H3 class="h2">我的身份</H3>
      <el-select v-model="role" placeholder="请选择">
        <el-option label="请选择" value=""></el-option>
        <el-option label="物流车队" value="物流车队" ></el-option>
        <el-option label="个人" value="个人" ></el-option>
      </el-select>
    <div style="margin: 16px;">
      <van-button round block type="info" @click="xiayibu" native-type="submit">下一步</van-button>
    </div>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  data() {
    return {
      form: {},
      role: '',
      enterpriseIntroduction: []
    }
  },
  created() {
    this.findList()
  },
  methods: {
    // 将企业介绍列表查询存储到enterpriseIntroduction中
    findList() {
      axios.get('/enterprise/list').then(res => {
        console.log(res)
        for (const re of res.data) {
          this.enterpriseIntroduction=re
        }
      })
    },
    // 转跳到下一步页面，如果没有选择我的身份就提示
    xiayibu(){
      if (this.role !== ''){
        localStorage.setItem('role',this.role)
        this.$router.push({path:'/RepairService'})
      }else {
        this.$message({
          message: '请输入身份',
          type: 'warning'
        });
      }
    },
    onClickLeft() {
      this.$router.go(-1)
    },
    showSelectIdentity() {
      this.showPopup = true
    },
    onCancel() {
      this.showPopup = false
    },
    onConfirm(value) {
      this.selectedIdentity = value[0]
      this.showPopup = false
    }
  }
}

</script>
<style>
p {
  text-indent: 2em; /* 2em 表示 2 个字符的宽度缩进 */
}
.vancell{
  text-align: left;
}
.h2{
  text-align: left;
}
h3 {
  margin-left: 10px;
}
.identity {
  display: inline-block;
  float: left;
  margin: 10px 10px;
}
.enterprise-introduction{
  margin: 10px 10px;
}
</style>
